# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgbase=mako
pkgname=("python3-${pkgbase}" "python2-${pkgbase}")
pkgver=1.0.1
pkgrel=2
pkgdesc="A super-fast templating language that borrows the best ideas from the existing templating languages"
arch=('i686' 'x86_64')
url="https://pypi.python.org/pypi/Mako"
makedepends=("python2-setuptools"
             "python3-setuptools"
             "python2-markupsafe"
             "python3-markupsafe"
             "python2-beaker"
             "python3-beaker")
checkdepends=("python2-nose"
              "python3-nose")
options=('staticlibs')
source=("https://pypi.python.org/packages/source/M/Mako/Mako-${pkgver}.tar.gz")
md5sums=('9f0aafd177b039ef67b90ea350497a54')

build() {
cd "$srcdir"
  rm -rf python{2,3}-build
  for builddir in python{2,3}-build; do
    cp -r Mako-$pkgver $builddir
    pushd $builddir
    /usr/bin/${builddir%-build} setup.py build
    popd
  done
}

check() {
  cd "$srcdir"
  for builddir in python{2,3}-build; do
    pushd $builddir
    /usr/bin/${builddir%-build} setup.py test
    popd
  done
}

package_python2-mako() {
  depends=("python2-markupsafe" "python2-beaker")

  cd "$srcdir/python2-build"
  /usr/bin/python2 setup.py install --prefix=/usr --root="$pkgdir" -O1

  mv ${pkgdir}/usr/bin/mako-render{,2}

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/python2-${pkgbase}/COPYING"
}

package_python3-mako() {
  depends=("python3-markupsafe" "python3-beaker")

  cd "$srcdir/python3-build"
  /usr/bin/python3 setup.py install --prefix=/usr --root="$pkgdir" -O1

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/python3-${pkgbase}/COPYING"
}
